<template>
    <!-- 商品组 -->
    <view class="diy-sharingGoods" :style="'background: ' + itemStyle.background + ';'">
        <view class="goods-item" v-for="(dataItem, index) in dataList" :key="index">
                <view class="btn-normal dis-flex" @tap="_onTargetGoods" :data-id="dataItem.goods_id">
                    <!-- 商品图片 -->
                    <view class="goods-item_left">
                        <image class="image" mode="aspectFill" :src="dataItem.image"></image>
                    </view>
                    <view class="goods-item_right">
                        <!-- 商品名称 -->
                        <view v-if="itemStyle.show.goodsName" class="goods-item_title twolist-hidden">
                            <text>{{ dataItem.goods_name }}</text>
                        </view>
                        <view class="goods-item_desc">
                            <!-- 商品卖点 -->
                            <view v-if="itemStyle.show.sellingPoint" class="desc-selling_point onelist-hidden">
                                <text>{{ dataItem.selling_point }}</text>
                            </view>
                            <!-- 拼团信息 -->
                            <view class="desc-situation">
                                <text class="iconfont icon-pintuan_huaban"></text>
                                <text class="people">{{ dataItem.people }}{{$t('pintuandingdan.rentuan')}}</text>
                                <text class="col-9">{{$t('pintuandingdan.yiyou')}}{{ dataItem.goods_sales }}{{$t('pintuandingdan.pintuans')}}</text>
                            </view>
                            <!-- 商品价格 -->
                            <view class="desc_footer">
                                <text class="price_x" v-if="itemStyle.show.sharingPrice">¥{{ dataItem.sharing_price }}</text>
                                <text class="price_y col-9" v-if="itemStyle.show.linePrice && dataItem.line_price > 0">¥{{ dataItem.line_price }}</text>
                            </view>
                        </view>
                        <view class="btn-settlement" >{{$t('pintuandingdan.qupintuan')}}</view>
                    </view>
                </view>
            
        </view>
    </view>
</template>

<script>
const app = getApp();
export default {
    data() {
        return {
            dataItem: {
                goods_id: '',
                image: '',
                goods_name: '',
                selling_point: '',
                people: '',
                goods_sales: '',
                sharing_price: '',
                line_price: 0
            }
        };
    },
    options: {
        addGlobalClass: true
    },
    /**
     * 组件的属性列表
     * 用于组件自定义设置
     */
    props: {
        itemIndex: String,
        itemStyle: Object,
        params: Object,
        dataList: Object
    },
    /**
     * 组件的方法列表
     * 更新属性和数据的方法与更新页面数据的方法类似
     */
    methods: {
        /**
         * 跳转商品详情页
         */
        _onTargetGoods(e) {
            // 记录formid
            app.globalData.saveFormId(e.detail.formId);
			console.log(e,"e.detail.target.dataset.id?")
            uni.navigateTo({
                url: '/pages/sharing/goods/index?goods_id=' + e.currentTarget.dataset.id
            });
        }
    }
};
</script>
<style>
@import './sharingGoods.css';
</style>
